<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="u" value="${newsupdate }" />
<div id="contents">
	<c:if test="${ regi eq 'y' }">
		<c:if test="${ isregi eq 'success' }">
			<div class="alert alert-success alert-dismissable">
				<button type="button" class="close" data-dismiss="alert"
					aria-hidden="true">&times;</button>
				<strong>뉴스 수정 성공!! 
			</div>
		</c:if>
		<c:if test="${ isregi eq 'fail' }">
			<div class="alert alert-danger alert-dismissable">
				<button type="button" class="close" data-dismiss="alert"
					aria-hidden="true">&times;</button>
				<strong>뉴스 수정 실패!</strong> 뉴스정보를 다시한번 확인해 주세요.
			</div>
		</c:if>
	</c:if>
	<form id="newsregi" method="post" enctype="multipart/form-data">
		<fieldset>
			<legend>뉴스 수정</legend>
			<div id="center">
				<div>
					<label for="newstit" class="control-label">제목</label> <input
						type="text" value="${u.newstit }" class="form-control"
						id="newstit" name="newstit" title="제목을 입력하세요" required="required" />
				</div>
				<div>
					<label for="newstype" class="control-label">등급</label> <select
						class="form-control" id="newstype" name="newstype"
						title="뉴스타입 선택하세요" required="required">
						<option>뉴스 타입</option>
						<option value="1">뉴스</option>
						<option value="2">인터뷰</option>
						<option value="3">리뷰</option>
					</select>
				</div>


				<div class="clear">
					<label for="writer" class="control-label">작성자</label> <input
						type="text" value="${u.writer }" class="form-control" id="writer"
						name="writer" placeholder="작성자" title="작성자의 이름을 입력하세요"
						required="required" />
				</div>

				<div id="nfile" class="clear">
					<input type="file" id="filechooser" name="poster"
						class="form-control" placeholder="뉴스 이미지 등록" title="뉴스 이미지를 선택하세요" />
				</div>
				<div>
					<label for="newscontents" class="control-label">뉴스</label>
					<textarea id="newscontents" class="form-control"
						name="newscontents" placeholder="뉴스내용" title="뉴스를 입력하세요."
						style="height: 315px">${u.newscontents}</textarea>
				</div>
				<div id="btn">
					<label class="control-label"></label>
					<button type="submit" class="btn btn-primary">수 정</button>
					<button type="button" class="btn btn-default"
						onclick="deleteNews(${u.newsno})">삭제</button>
				</div>
			</div>
		</fieldset>
	</form>
</div>

<script>
	function deleteNews(newsno) {
		var newsno;

		location.href = "news_delete.bi?newsno=" + newsno;
	}
</script>